package com.zr.model;


import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Driver generated by hbm2java
 */
@Entity
@Table(name = "driver", catalog = "lms")
public class Driver implements java.io.Serializable {

	private Integer driverId;
	private User user;
	private String driverName;
	private String driverPhone;
	private Set<Line> lines = new HashSet<Line>(0);
	private Set<Cargostatus> cargostatuses = new HashSet<Cargostatus>(0);
	private Set<Deliveryreceitp> deliveryreceitps = new HashSet<Deliveryreceitp>(0);

	public Driver() {
	}

	public Driver(User user, String driverName, String driverPhone, Set<Line> lines, Set<Cargostatus> cargostatuses,
			Set<Deliveryreceitp> deliveryreceitps) {
		this.user = user;
		this.driverName = driverName;
		this.driverPhone = driverPhone;
		this.lines = lines;
		this.cargostatuses = cargostatuses;
		this.deliveryreceitps = deliveryreceitps;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)

	@Column(name = "driverId", unique = true, nullable = false)
	public Integer getDriverId() {
		return this.driverId;
	}

	public void setDriverId(Integer driverId) {
		this.driverId = driverId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "uid")
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@Column(name = "driverName")
	public String getDriverName() {
		return this.driverName;
	}

	public void setDriverName(String driverName) {
		this.driverName = driverName;
	}

	@Column(name = "driverPhone")
	public String getDriverPhone() {
		return this.driverPhone;
	}

	public void setDriverPhone(String driverPhone) {
		this.driverPhone = driverPhone;
	}

	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "driverschedule", catalog = "lms", joinColumns = {
			@JoinColumn(name = "driverId", nullable = false, updatable = false) }, inverseJoinColumns = {
					@JoinColumn(name = "lineId", nullable = false, updatable = false) })
	public Set<Line> getLines() {
		return this.lines;
	}

	public void setLines(Set<Line> lines) {
		this.lines = lines;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "driver")
	public Set<Cargostatus> getCargostatuses() {
		return this.cargostatuses;
	}

	public void setCargostatuses(Set<Cargostatus> cargostatuses) {
		this.cargostatuses = cargostatuses;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "driver")
	public Set<Deliveryreceitp> getDeliveryreceitps() {
		return this.deliveryreceitps;
	}

	public void setDeliveryreceitps(Set<Deliveryreceitp> deliveryreceitps) {
		this.deliveryreceitps = deliveryreceitps;
	}

}
